<?php
/**
* @Author:  	Daniel Dinh
* @Email:   	webdevelopmentvn@gmail.com
* @Link: 		http://joomsoft.net
* @Version: 	1.0
* @copyright:	Joomsoft.net
* @license:		GNU Lesser GPL
*/

// No direct access.
defined('_JEXEC') or die();

class JFormFieldSupplier extends JFormField
{
	protected $type 		= 'supplier';

	protected function getInput() {
		$db = & JFactory::getDBO();
		$first[]  = array('value'=>0,'text'=>JText::_("COM_DANIPRO_SELECT_SUPPLIER"));
		$db->setQuery("select id as value,title as text from #__dani_supplier where published=1 order by title");
		$rows = $db->loadObjectList();
		if($rows)
			$options  = array_merge($first,$rows);
		else
			$options = $first;
		return JHTML::_("select.genericlist",$options,'jform['.$this->element['name'].']',$this->element['class'],'value','text',$this->value);
	}
}
?>